package shop.services.front.cart.dao.impl;

import org.springframework.stereotype.Repository;
import shop.core.common.dao.BaseDao;
import shop.core.common.dao.page.PagerModel;
import shop.services.front.cart.bean.Cart;
import shop.services.front.cart.dao.CartDao;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2017/4/25.
 */
@Repository("cartDaoFront")
public class CartDaoImpl implements CartDao {
    @Resource
    private BaseDao dao;
    public void setDao(BaseDao dao){this.dao=dao;}

    public CartDaoImpl() {
        super();
    }

    @Override
    public int insert(Cart cart) {
        return dao.insert("front.cart.insert",cart);
    }

    @Override
    public int delete(Cart cart) {
        return dao.delete("front.cart.deleteProduct",cart);
    }

    @Override
    public int update(Cart cart) {
        return 0;
    }

    @Override
    public Cart selectOne(Cart cart) {
        return (Cart) dao.selectOne("front.cart.selectOne", cart);
    }

    @Override
    public PagerModel selectPageList(Cart cart) {
        return null;
    }

    @Override
    public List<Cart> selectList(Cart cart) {
        return dao.selectList("front.cart.selectList",cart);
    }

    @Override
    public int deleteById(int id) {
        return dao.delete("front.cart.deleteById",id);
    }

    @Override
    public Cart selectById(String id) {
        return null;
    }

    @Override
    public List<Cart> selectProduct(Cart cart) {
        return (List<Cart>) dao.selectList("front.cart.selectProduct",cart);
    }
}
